extends NodeState

# 控球状态持续时间
const DURATION_CONTROL := 0.5

var control_time: float = 0.0

var player: Player:
	get:
		return state_matchine.root as Player


func _on_process(delta : float) -> void:
	process_control(delta)


func _on_enter(_data: NodeStateData) -> void:
	control_time = 0.0
	process_animation()


func _on_exit() -> void:
	pass



func process_control(delta : float):
	if control_time >= DURATION_CONTROL:
		if player.input_manager.is_movement():
			transition_state(Player.STATE_RUN)
		else:
			transition_state(Player.STATE_IDLE)
		return
	control_time += delta



func process_animation():
	player.animation_player.play(Player.ANIMATION_CHEST_CONTROL)
